package cn.lyjuan.android.demofive.ui.component.time_picker_dialog;

import android.app.Activity;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.TimePicker;
import cn.lyjuan.android.demofive.R;

/**
 * Created by chad on 2016/1/20.
 */
public class TimePickerDialogActivity extends Activity implements TimePickerDialogFragment.OnTimeSetCallback {

    TextView text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.ui_time_picker_dialog);

        text = (TextView) this.findViewById(R.id.ui_time_picker_dialog_text);
    }

    public void showTimeDialog(View v)
    {
        DialogFragment dialog = new TimePickerDialogFragment();

        dialog.show(this.getFragmentManager(), "TimePickerDialog");
    }

    @Override
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
        text.setText("时间：" + hourOfDay + ":" + minute);
    }
}
